#include"process.h"
#include<time.h>
#include<stdlib.h>
#include<unistd.h>

const int base = 20;
double total = 2048.0; // 2048MB
double once = 0.1;     // 0.5MB

void download()
{
    double  current = 0.0;
    while(current < total)
    {
        int r = rand() % base + 1;
        double speed = r * once;
        current += speed;
        if(current >= total) current = total;
        usleep(1000);
        
        Process(total, current);

        // printf("test:%.1lf/%.1lf\r", current, total);
        // fflush(stdout);
    }
    printf("\n");
}


int main()
{
    srand(time(NULL));
    printf("Hello Linux!\n");
    download();
    // Process();
    return 0;
}

